/**
 * 球杆模型
 */

import {
  Entity,
  Column,
  OneToOne,
  JoinColumn,
  CreateDateColumn,
  PrimaryColumn
} from "typeorm";
import { BblAttach } from "./attach.entity";

@Entity("BBL_CLUB")
export class BblClub {
  @PrimaryColumn({
    name: "CLUB_ID",
    type: "varchar",
    length: 50,
    comment: "球杆ID"
  })
  clubId: string;

  @Column({
    name: "CLUB_MAIN_NAME",
    type: "varchar",
    length: 255,
    nullable: false,
    comment: "球杆主标题"
  })
  clubMainName: string;

  @Column({
    name: "CLUB_SUB_NAME",
    type: "varchar",
    length: 255,
    nullable: false,
    comment: "球杆副标题"
  })
  clubSubName: string;

  @Column({
    name: "CLUB_PRICE",
    type: "int",
    nullable: false,
    comment: "球杆价格"
  })
  clubPrice: number;

  @OneToOne((type) => BblAttach, { createForeignKeyConstraints: false })
  @JoinColumn({
    name: "CLUB_IMG_ID",
    referencedColumnName: "attId"
  })
  clubImg: BblAttach;

  @CreateDateColumn({
    type: "timestamp",
    name: "CREATE_AT"
  })
  createAt: Date;
}
